home *** CD-ROM | disk | FTP | other *** search
- /*
- cvdialog.cpp
-
- Example dialog box
-
- C++/Views 2.0 Demo
- Copyright (c) 1992, by Liant Software Corp.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- */
-
- #include "cvdialog.h"
- #include "editline.h"
- #include "pushbttn.h"
- #include "combobox.h"
- #include "exclgrp.h"
- #include "radibttn.h"
- #include "textbox.h"
- #include "listbox.h"
- #include "cvcolor.h"
- #include "cvdemovw.h"
- #include "messengr.h"
- #include "cvhow.h"
-
- defineClass(DialogView, VDialog)
-
- char *radioBttns[] = { "Illuminati", "Jesuits", "Masons", "Templars", 0 };
-
- DialogView::DialogView()
- {
- ;
- }
-
- DialogView::DialogView(VWindow *parent)
- : VDialog(30, 10, 150, 180, parent)
- {
- setTitle("C++/Views Sample Dialog");
-
- /* add an edit line */
- pEdit = new VEditLine(VFrame(160, 18, 110, 25), this, StyleBorder);
- new VTextBox(VFrame(40, 20, 100, 25), this, StyleRight, "Edit Line");
-
- /* add a combo box */
- VComboBox *pCombo;
- pCombo = new VComboBox(VFrame(160, 58, 120, 140), this, StyleComboDrop);
- new VTextBox(VFrame(40, 60, 100, 25), this, StyleRight, "Combo Box");
-
- pCombo->appendString("Ball and Chain");
- pCombo->appendString("Block and Tackle");
- pCombo->appendString("Chutes and Ladders");
- pCombo->appendString("Gin and Tonic");
- pCombo->appendString("Martin and Lewis");
- pCombo->appendString("Mortar and Pestle");
- pCombo->appendString("Ren and Stimpy");
- pCombo->appendString("Pastrami and Rye");
- pCombo->appendString("Sturm und Drang");
-
- /* add a custom control */
- new ColorControl(VFrame(160, 90, 120, 50), this, StyleBorder);
- new VTextBox(VFrame(10, 90, 130, 25), this, StyleRight, "Custom Control");
-
- /* create a group of exclusive radio buttons */
- VExclusiveGroup *group;
-
- group = new VExclusiveGroup(VFrame(20, 150, 120, 123), this,
- "Exclusive Group", VRadioButtonCls);
- group->addButtons(radioBttns, .1F, .2F, .8F, .15F, 0.0F, .05F);
-
- /* create a list box */
- new VTextBox(VFrame(160, 156, 120, 20), this, StyleLeft, "List Box");
- listBox = new VListBox(VFrame(160, 178, 120, 97), this, StyleBorder | StyleTitle);
- listBox->uponClick(this, methodOf(DialogView, listClick),
- methodOf(DialogView, listDblClick));
-
- listBox->appendString("Account");
- listBox->appendString("Atlas");
- listBox->appendString("Catalog");
- listBox->appendString("Compendium");
- listBox->appendString("Directory");
- listBox->appendString("Enumeration");
- listBox->appendString("Index");
- listBox->appendString("Litany");
- listBox->appendString("Register");
- listBox->appendString("Roster");
- listBox->appendString("Tally");
-
- /* create pushbuttons */
- VPushButton *okButton;
- okButton = new VPushButton(VFrame(20, 300, 50, 30), this, StyleDefault, "Ok");
- okButton->uponClick(this, methodOf(DialogView, okBtn));
-
- VPushButton *cancelButton;
- cancelButton = new VPushButton(VFrame(230, 300, 50, 30), this, StyleDefault, "Cancel");
- cancelButton->uponClick(this, methodOf(DialogView, cancelBtn));
-
- VPushButton *aboutButton;
- aboutButton = new VPushButton(VFrame(125, 300, 50, 30), this, StyleDefault, "About");
- aboutButton->uponClick(this, methodOf(DialogView, aboutBtn));
- }
-
- DialogView::~DialogView()
- {
- ;
- }
-
- boolean DialogView::free()
- {
- delete this;
- return(TRUE);
- }
-
- boolean DialogView::okBtn(VButton *b)
- /*
- "Ok" button pressed
- */
- {
- endModal();
- return(TRUE);
- }
-
- boolean DialogView::cancelBtn(VButton *b)
- /*
- "Cancel" button pressed
- */
- {
- endModal();
- return(TRUE);
- }
-
- boolean DialogView::aboutBtn(VButton *b)
- /*
- "About" button pressed
- */
- {
- /* Display a "How-does-it-work" dialog */
- HowView how(this, "Dialog:About", "cvdialog.cpp");
-
- /* make the about how visible */
- how.show();
-
- /* activate the dialog (as a modal dialog) */
- how.modal();
-
- return(TRUE);
- }
-
- boolean DialogView::listClick(int index)
- /*
- Mouse clicked on the list box
- */
- {
- return(TRUE);
- }
-
- boolean DialogView::listDblClick(int index)
- /*
- Mouse double-clicked on the list box
- */
- {
- /* copy the current choice into the editline */
- VString *temp;
- temp = listBox->selectedString();
-
- pEdit->putText(temp->gets());
-
- delete temp;
-
- return(TRUE);
- }
-
-